Data

alcohol <- read.csv("student-mat-recoded.csv")
head(alcohol)
##   school sex age address famsize  Pstatus                Medu
## 1     GP   F  18   Urban     GT3    alone    higher education
## 2     GP   F  17   Urban     GT3 together           4th grade
## 3     GP   F  15   Urban     LE3 together           4th grade
## 4     GP   F  15   Urban     GT3 together    higher education
## 5     GP   F  16   Urban     GT3 together secondary education
## 6     GP   M  16   Urban     LE3 together    higher education
##                  Fedu     Mjob     Fjob     reason guardian traveltime
## 1    higher education  at_home  teacher     course   mother  15-30 min
## 2           4th grade  at_home    other     course   father    <15 min
## 3           4th grade  at_home    other      other   mother    <15 min
## 4     5th - 9th grade   health services       home   mother    <15 min
## 5 secondary education    other    other       home   father    <15 min
## 6 secondary education services    other reputation   mother    <15 min
##   studytime failures schoolsup famsup paid activities nursery higher internet
## 1   2-5 hrs        0       yes     no   no         no     yes    yes       no
## 2   2-5 hrs        0        no    yes   no         no      no    yes      yes
## 3   2-5 hrs        3       yes     no  yes         no     yes    yes      yes
## 4  5-10 hrs        0        no    yes  yes        yes     yes    yes      yes
## 5   2-5 hrs        0        no    yes  yes         no     yes    yes       no
## 6   2-5 hrs        0        no    yes  yes        yes     yes    yes      yes
##   romantic    famrel freetime    goout     Dalc     Walc    health absences G1
## 1       no      good moderate     high very low very low  moderate        6  5
## 2       no excellent moderate moderate very low very low  moderate        4  5
## 3       no      good moderate      low      low moderate  moderate       10  7
## 4      yes  moderate      low      low very low very low very good        2 15
## 5       no      good moderate      low very low      low very good        4  6
## 6       no excellent     high      low very low      low very good       10 15
##   G2 G3
## 1  6  6
## 2  5  6
## 3  8 10
## 4 14 15
## 5 10 10
## 6 15 15

LASSO

run 4 lasso regressions separated on 4 types of variables: Personal, Main Academic, Family, and School Variables

General Interpretation: For each Walc prediction, the coefficient shown is related to whether it is associated with the Walc outcome and how much it affects the outcome.

LASSO on Personal

#Transform data into matrix

x1 <- model.matrix( Walc ~ 1 + sex + age + address + internet + romantic + health, alcohol)[,-1]

y1 <- as.matrix(alcohol["Walc"])

grid=10^seq(10,-2, length =100)
lasso.mod <- glmnet(x1,y1,alpha = 1, lambda = grid, family="multinomial")
plot(lasso.mod)
## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

set.seed(123)

#Split data into train, test dataset

train <- sample(1:nrow(x1),nrow(x1)/2)
test <- (-train)

# Run Cross-Validatiom

cv.out <- cv.glmnet(x1,y1,alpha = 1, family="multinomial")
plot(cv.out)

best_lambda <- cv.out$lambda.min
best_lambda
## [1] 0.0200501
lasso.coef <- predict (lasso.mod ,type = "coefficients",s= best_lambda)
lasso.coef
## $high
## 10 x 1 sparse Matrix of class "dgCMatrix"
##                           1
## (Intercept)     -1.24620344
## sexM             0.79275873
## age              .         
## addressUrban     .         
## internetyes      .         
## romanticyes     -0.02327201
## healthgood       .         
## healthmoderate   .         
## healthvery bad   .         
## healthvery good  0.34617525
## 
## $low
## 10 x 1 sparse Matrix of class "dgCMatrix"
##                          1
## (Intercept)     -0.1647016
## sexM             .        
## age              .        
## addressUrban     .        
## internetyes      .        
## romanticyes      .        
## healthgood       .        
## healthmoderate   .        
## healthvery bad   .        
## healthvery good  .        
## 
## $moderate
## 10 x 1 sparse Matrix of class "dgCMatrix"
##                            1
## (Intercept)     -0.253329589
## sexM             .          
## age              0.001662019
## addressUrban     .          
## internetyes      .          
## romanticyes      .          
## healthgood       .          
## healthmoderate   .          
## healthvery bad   .          
## healthvery good  .          
## 
## $`very high`
## 10 x 1 sparse Matrix of class "dgCMatrix"
##                          1
## (Intercept)     -1.9735655
## sexM             1.1606924
## age              .        
## addressUrban     .        
## internetyes      .        
## romanticyes      .        
## healthgood       0.1102719
## healthmoderate   .        
## healthvery bad   .        
## healthvery good  .        
## 
## $`very low`
## 10 x 1 sparse Matrix of class "dgCMatrix"
##                            1
## (Intercept)      3.637800160
## sexM            -0.153129376
## age             -0.196731895
## addressUrban     0.266810422
## internetyes     -0.098800380
## romanticyes      .          
## healthgood       0.008123843
## healthmoderate   0.119964233
## healthvery bad   .          
## healthvery good -0.121547057

Interpretation: Because the variable internet appears the least in all 5 outcomes, it seems that it might not have a huge effect on alcohol consumption.

LASSO on Academic

x1 <- model.matrix( Walc ~ 1 + studytime + failures + schoolsup + paid + nursery + higher + G1 + G2 + G3, alcohol)[,-1]

y1 <- as.matrix(alcohol["Walc"])

grid=10^seq(10,-2, length =100)
lasso.mod <- glmnet(x1,y1,alpha = 1, lambda = grid, family="multinomial")
plot(lasso.mod)
## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

set.seed(123)

#Split data into train, test dataset

train <- sample(1:nrow(x1),nrow(x1)/2)
test <- (-train)

# Run Cross-Validatiom

cv.out <- cv.glmnet(x1,y1,alpha = 1, family="multinomial")
plot(cv.out)

best_lambda <- cv.out$lambda.min
best_lambda
## [1] 0.01225056
lasso.coef <- predict (lasso.mod ,type = "coefficients",s= best_lambda)
lasso.coef
## $high
## 12 x 1 sparse Matrix of class "dgCMatrix"
##                             1
## (Intercept)        0.25033443
## studytime>10 hrs  -0.11470444
## studytime2-5 hrs   .         
## studytime5-10 hrs -0.82049409
## failures           .         
## schoolsupyes       .         
## paidyes            .         
## nurseryyes         .         
## higheryes          .         
## G1                -0.03719768
## G2                -0.01727566
## G3                 .         
## 
## $low
## 12 x 1 sparse Matrix of class "dgCMatrix"
##                             1
## (Intercept)       -0.29810238
## studytime>10 hrs   .         
## studytime2-5 hrs   .         
## studytime5-10 hrs  .         
## failures           .         
## schoolsupyes      -0.52301411
## paidyes            .         
## nurseryyes         .         
## higheryes          0.38046745
## G1                 0.04653959
## G2                 .         
## G3                -0.04276966
## 
## $moderate
## 12 x 1 sparse Matrix of class "dgCMatrix"
##                            1
## (Intercept)       0.00370346
## studytime>10 hrs  .         
## studytime2-5 hrs  0.01614941
## studytime5-10 hrs .         
## failures          .         
## schoolsupyes      .         
## paidyes           0.02924976
## nurseryyes        .         
## higheryes         .         
## G1                .         
## G2                .         
## G3                .         
## 
## $`very high`
## 12 x 1 sparse Matrix of class "dgCMatrix"
##                            1
## (Intercept)       -0.1510636
## studytime>10 hrs   .        
## studytime2-5 hrs   .        
## studytime5-10 hrs -0.4148292
## failures           0.2753324
## schoolsupyes       .        
## paidyes            .        
## nurseryyes        -0.3072604
## higheryes         -0.7802255
## G1                 .        
## G2                 .        
## G3                 .        
## 
## $`very low`
## 12 x 1 sparse Matrix of class "dgCMatrix"
##                              1
## (Intercept)        0.195128101
## studytime>10 hrs   1.289378128
## studytime2-5 hrs   0.475366568
## studytime5-10 hrs  0.761156257
## failures          -0.070488118
## schoolsupyes       0.546655950
## paidyes           -0.530494334
## nurseryyes         0.173155369
## higheryes         -0.018493151
## G1                 0.001243482
## G2                 0.003967575
## G3                 .

Interpretation: BEcause all variables appear about the same time (2 - 4 times) in each Walc observation, all the variables might be associated to the Walc outcome.

LASSO on Family

x1 <- model.matrix( Walc ~ 1 + famsize + Pstatus + Medu + Fedu + Mjob + Fjob + guardian + famsup + famrel, alcohol)[,-1]

y1 <- as.matrix(alcohol["Walc"])

grid=10^seq(10,-2, length =100)
lasso.mod <- glmnet(x1,y1,alpha = 1, lambda = grid, family="multinomial")
plot(lasso.mod)
## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

set.seed(123)

#Split data into train, test dataset

train <- sample(1:nrow(x1),nrow(x1)/2)
test <- (-train)

# Run Cross-Validatiom

cv.out <- cv.glmnet(x1,y1,alpha = 1, family="multinomial")
plot(cv.out)

best_lambda <- cv.out$lambda.min
best_lambda
## [1] 0.05000156
lasso.coef <- predict (lasso.mod ,type = "coefficients",s= best_lambda)
lasso.coef
## $high
## 26 x 1 sparse Matrix of class "dgCMatrix"
##                                  1
## (Intercept)             -0.2857815
## famsizeLE3               .        
## Pstatustogether          .        
## Medu5th - 9th grade      .        
## Meduhigher education     .        
## Medunone                 .        
## Medusecondary education  .        
## Fedu5th - 9th grade      .        
## Feduhigher education     .        
## Fedunone                 .        
## Fedusecondary education  .        
## Mjobhealth               .        
## Mjobother                .        
## Mjobservices             .        
## Mjobteacher              .        
## Fjobhealth               .        
## Fjobother                .        
## Fjobservices             .        
## Fjobteacher              .        
## guardianmother           .        
## guardianother            .        
## famsupyes                .        
## famrelexcellent          .        
## famrelgood               .        
## famrelmoderate           .        
## famrelvery bad           .        
## 
## $low
## 26 x 1 sparse Matrix of class "dgCMatrix"
##                                 1
## (Intercept)             0.2250439
## famsizeLE3              .        
## Pstatustogether         .        
## Medu5th - 9th grade     .        
## Meduhigher education    .        
## Medunone                .        
## Medusecondary education .        
## Fedu5th - 9th grade     .        
## Feduhigher education    .        
## Fedunone                .        
## Fedusecondary education .        
## Mjobhealth              .        
## Mjobother               .        
## Mjobservices            .        
## Mjobteacher             .        
## Fjobhealth              .        
## Fjobother               .        
## Fjobservices            .        
## Fjobteacher             .        
## guardianmother          .        
## guardianother           .        
## famsupyes               .        
## famrelexcellent         .        
## famrelgood              .        
## famrelmoderate          .        
## famrelvery bad          .        
## 
## $moderate
## 26 x 1 sparse Matrix of class "dgCMatrix"
##                                   1
## (Intercept)              0.14724831
## famsizeLE3               .         
## Pstatustogether          0.01939514
## Medu5th - 9th grade      .         
## Meduhigher education     .         
## Medunone                 .         
## Medusecondary education  .         
## Fedu5th - 9th grade      .         
## Feduhigher education     .         
## Fedunone                 .         
## Fedusecondary education  .         
## Mjobhealth               .         
## Mjobother                .         
## Mjobservices             .         
## Mjobteacher              .         
## Fjobhealth              -0.00596914
## Fjobother                .         
## Fjobservices             .         
## Fjobteacher              .         
## guardianmother           .         
## guardianother            .         
## famsupyes                .         
## famrelexcellent          .         
## famrelgood               .         
## famrelmoderate           .         
## famrelvery bad           .         
## 
## $`very high`
## 26 x 1 sparse Matrix of class "dgCMatrix"
##                                  1
## (Intercept)             -0.8854029
## famsizeLE3               .        
## Pstatustogether          .        
## Medu5th - 9th grade      .        
## Meduhigher education     .        
## Medunone                 .        
## Medusecondary education  .        
## Fedu5th - 9th grade      .        
## Feduhigher education     .        
## Fedunone                 .        
## Fedusecondary education  .        
## Mjobhealth               .        
## Mjobother                .        
## Mjobservices             .        
## Mjobteacher              .        
## Fjobhealth               .        
## Fjobother                .        
## Fjobservices             .        
## Fjobteacher              .        
## guardianmother           .        
## guardianother            .        
## famsupyes                .        
## famrelexcellent          .        
## famrelgood               .        
## famrelmoderate           .        
## famrelvery bad           .        
## 
## $`very low`
## 26 x 1 sparse Matrix of class "dgCMatrix"
##                                     1
## (Intercept)              0.7988921401
## famsizeLE3              -0.0055215615
## Pstatustogether          .           
## Medu5th - 9th grade      .           
## Meduhigher education     .           
## Medunone                 .           
## Medusecondary education  .           
## Fedu5th - 9th grade      .           
## Feduhigher education     .           
## Fedunone                 0.0576033117
## Fedusecondary education  .           
## Mjobhealth               .           
## Mjobother                .           
## Mjobservices             .           
## Mjobteacher              .           
## Fjobhealth               0.0480260141
## Fjobother                .           
## Fjobservices             .           
## Fjobteacher              .           
## guardianmother           .           
## guardianother            .           
## famsupyes                .           
## famrelexcellent          .           
## famrelgood               .           
## famrelmoderate          -0.0009581581
## famrelvery bad           .

Interpretation: For most of Walc outcome, it seems that most variables to not appear, which might mean that generally, the variables within the Family category might not be associated to the Walc outcome.

LASSO on School

x1 <- model.matrix( Walc ~ 1 + school + reason + traveltime + activities + freetime + goout + absences, alcohol)[,-1]

y1 <- as.matrix(alcohol["Walc"])

grid=10^seq(10,-2, length =100)
lasso.mod <- glmnet(x1,y1,alpha = 1, lambda = grid, family="multinomial")
plot(lasso.mod)
## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

set.seed(123)

#Split data into train, test dataset

train <- sample(1:nrow(x1),nrow(x1)/2)
test <- (-train)

# Run Cross-Validatiom

cv.out <- cv.glmnet(x1,y1,alpha = 1, family="multinomial")
plot(cv.out)

best_lambda <- cv.out$lambda.min
best_lambda
## [1] 0.01667076
lasso.coef <- predict (lasso.mod ,type = "coefficients",s= best_lambda)
lasso.coef
## $high
## 18 x 1 sparse Matrix of class "dgCMatrix"
##                                   1
## (Intercept)              0.23404143
## schoolMS                 .         
## reasonhome               .         
## reasonother              .         
## reasonreputation        -0.12716076
## traveltime>1 hr          .         
## traveltime15-30 min      .         
## traveltime30 min - 1 hr  0.01961985
## activitiesyes            .         
## freetimelow              .         
## freetimemoderate        -0.05541240
## freetimevery high        .         
## freetimevery low        -0.57397535
## gooutlow                -0.29502578
## gooutmoderate           -1.05070386
## gooutvery high           0.12535695
## gooutvery low            .         
## absences                 0.01419382
## 
## $low
## 18 x 1 sparse Matrix of class "dgCMatrix"
##                                    1
## (Intercept)              0.022786562
## schoolMS                 .          
## reasonhome               .          
## reasonother             -0.033837479
## reasonreputation         .          
## traveltime>1 hr          .          
## traveltime15-30 min      .          
## traveltime30 min - 1 hr  .          
## activitiesyes           -0.029498862
## freetimelow              1.000133206
## freetimemoderate         0.007374884
## freetimevery high        .          
## freetimevery low         .          
## gooutlow                 0.755763462
## gooutmoderate            0.329836537
## gooutvery high           .          
## gooutvery low            0.026561956
## absences                -0.015604173
## 
## $moderate
## 18 x 1 sparse Matrix of class "dgCMatrix"
##                                 1
## (Intercept)             0.2764548
## schoolMS                0.4214981
## reasonhome              .        
## reasonother             .        
## reasonreputation        0.1069719
## traveltime>1 hr         .        
## traveltime15-30 min     .        
## traveltime30 min - 1 hr .        
## activitiesyes           .        
## freetimelow             .        
## freetimemoderate        .        
## freetimevery high       .        
## freetimevery low        .        
## gooutlow                .        
## gooutmoderate           .        
## gooutvery high          .        
## gooutvery low           .        
## absences                .        
## 
## $`very high`
## 18 x 1 sparse Matrix of class "dgCMatrix"
##                                     1
## (Intercept)             -1.2811584466
## schoolMS                 .           
## reasonhome               .           
## reasonother              0.0059139055
## reasonreputation         .           
## traveltime>1 hr          2.7284452349
## traveltime15-30 min     -0.0602850283
## traveltime30 min - 1 hr  .           
## activitiesyes            .           
## freetimelow              .           
## freetimemoderate         .           
## freetimevery high        .           
## freetimevery low         0.0311984372
## gooutlow                 .           
## gooutmoderate           -0.0001389792
## gooutvery high           1.6377032021
## gooutvery low            .           
## absences                 .           
## 
## $`very low`
## 18 x 1 sparse Matrix of class "dgCMatrix"
##                                   1
## (Intercept)              0.74787564
## schoolMS                -0.36943466
## reasonhome               .         
## reasonother             -0.21794296
## reasonreputation         .         
## traveltime>1 hr          .         
## traveltime15-30 min      .         
## traveltime30 min - 1 hr -0.41299230
## activitiesyes            0.26050677
## freetimelow              .         
## freetimemoderate         .         
## freetimevery high       -0.06830581
## freetimevery low         0.36409196
## gooutlow                 0.91492105
## gooutmoderate            .         
## gooutvery high          -0.24073372
## gooutvery low            1.15008333
## absences                -0.01620053

Interpretation: Generally, it seems that the variables are consistently appearing for each Walc observation, which might mean that the variables within this category have association with the Walc outcome.

LASSO on Everything

x1 <- model.matrix( Walc ~ 1 + sex + age + address + internet + romantic + health + studytime + failures + schoolsup + paid + nursery + higher + G1 + G2 + G3 + famsize + Pstatus + Medu + Fedu + Mjob + Fjob + guardian + famsup + famrel + school + reason + traveltime + activities + freetime + goout + absences, alcohol)[,-1]

y1 <- as.matrix(alcohol["Walc"])

grid=10^seq(10,-2, length =100)
lasso.mod <- glmnet(x1,y1,alpha = 1, lambda = grid, family="multinomial")
plot(lasso.mod)
## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

## Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
## collapsing to unique 'x' values

set.seed(123)

#Split data into train, test dataset

train <- sample(1:nrow(x1),nrow(x1)/2)
test <- (-train)

# Run Cross-Validatiom

cv.out <- cv.glmnet(x1,y1,alpha = 1, family="multinomial")
plot(cv.out)

best_lambda <- cv.out$lambda.min
best_lambda
## [1] 0.02203776
lasso.coef <- predict (lasso.mod ,type = "coefficients",s= best_lambda)
lasso.coef
## $high
## 63 x 1 sparse Matrix of class "dgCMatrix"
##                                     1
## (Intercept)             -0.1284263039
## sexM                     0.7667975886
## age                      .           
## addressUrban             .           
## internetyes              .           
## romanticyes             -0.0046782999
## healthgood              -0.0002491843
## healthmoderate           .           
## healthvery bad           .           
## healthvery good          0.2806202242
## studytime>10 hrs         .           
## studytime2-5 hrs         .           
## studytime5-10 hrs       -0.0153482923
## failures                 .           
## schoolsupyes             .           
## paidyes                  .           
## nurseryyes               .           
## higheryes                .           
## G1                      -0.0238068802
## G2                       .           
## G3                       .           
## famsizeLE3               .           
## Pstatustogether          .           
## Medu5th - 9th grade     -0.1570666514
## Meduhigher education     .           
## Medunone                 0.0378641745
## Medusecondary education  0.1233823278
## Fedu5th - 9th grade      .           
## Feduhigher education     .           
## Fedunone                 .           
## Fedusecondary education  0.0060123576
## Mjobhealth               .           
## Mjobother                .           
## Mjobservices             .           
## Mjobteacher              .           
## Fjobhealth               .           
## Fjobother                .           
## Fjobservices             .           
## Fjobteacher             -0.0800347072
## guardianmother           .           
## guardianother           -0.4085083436
## famsupyes               -0.1060857850
## famrelexcellent          .           
## famrelgood               .           
## famrelmoderate           0.0213395012
## famrelvery bad           .           
## schoolMS                 .           
## reasonhome               .           
## reasonother              .           
## reasonreputation         .           
## traveltime>1 hr          .           
## traveltime15-30 min      .           
## traveltime30 min - 1 hr  .           
## activitiesyes            .           
## freetimelow              .           
## freetimemoderate         .           
## freetimevery high        .           
## freetimevery low        -0.1075673746
## gooutlow                -0.2256195249
## gooutmoderate           -0.8538818529
## gooutvery high           0.0248931099
## gooutvery low            .           
## absences                 0.0102634017
## 
## $low
## 63 x 1 sparse Matrix of class "dgCMatrix"
##                                    1
## (Intercept)             -0.039792125
## sexM                     .          
## age                      .          
## addressUrban             .          
## internetyes              0.017018142
## romanticyes              .          
## healthgood               .          
## healthmoderate           .          
## healthvery bad           .          
## healthvery good          .          
## studytime>10 hrs         .          
## studytime2-5 hrs         .          
## studytime5-10 hrs        .          
## failures                 .          
## schoolsupyes            -0.325712940
## paidyes                  .          
## nurseryyes               .          
## higheryes                .          
## G1                       .          
## G2                       .          
## G3                      -0.007738140
## famsizeLE3               .          
## Pstatustogether          0.109419890
## Medu5th - 9th grade      .          
## Meduhigher education     .          
## Medunone                -0.071583392
## Medusecondary education  .          
## Fedu5th - 9th grade      .          
## Feduhigher education     0.004439740
## Fedunone                 .          
## Fedusecondary education  .          
## Mjobhealth              -0.109152912
## Mjobother                .          
## Mjobservices             .          
## Mjobteacher              .          
## Fjobhealth               .          
## Fjobother                .          
## Fjobservices             .          
## Fjobteacher              0.007902992
## guardianmother           .          
## guardianother            .          
## famsupyes                .          
## famrelexcellent          0.008406682
## famrelgood               .          
## famrelmoderate           .          
## famrelvery bad           .          
## schoolMS                 .          
## reasonhome               .          
## reasonother              .          
## reasonreputation         .          
## traveltime>1 hr          .          
## traveltime15-30 min      .          
## traveltime30 min - 1 hr  .          
## activitiesyes            .          
## freetimelow              0.907403942
## freetimemoderate         .          
## freetimevery high        .          
## freetimevery low         .          
## gooutlow                 0.656287057
## gooutmoderate            0.273033991
## gooutvery high           .          
## gooutvery low            .          
## absences                -0.011128079
## 
## $moderate
## 63 x 1 sparse Matrix of class "dgCMatrix"
##                                     1
## (Intercept)             -0.2566559481
## sexM                     .           
## age                      .           
## addressUrban             .           
## internetyes              .           
## romanticyes              .           
## healthgood               .           
## healthmoderate           .           
## healthvery bad           .           
## healthvery good          .           
## studytime>10 hrs         .           
## studytime2-5 hrs         .           
## studytime5-10 hrs        .           
## failures                 .           
## schoolsupyes             .           
## paidyes                  .           
## nurseryyes               .           
## higheryes                .           
## G1                       .           
## G2                       .           
## G3                       0.0001109037
## famsizeLE3               .           
## Pstatustogether          0.5437422894
## Medu5th - 9th grade     -0.0165928870
## Meduhigher education     .           
## Medunone                 .           
## Medusecondary education  0.0060769150
## Fedu5th - 9th grade      .           
## Feduhigher education    -0.0916196474
## Fedunone                 .           
## Fedusecondary education  .           
## Mjobhealth               0.1663051503
## Mjobother                .           
## Mjobservices             .           
## Mjobteacher              .           
## Fjobhealth              -0.6188636081
## Fjobother                0.0018459564
## Fjobservices             .           
## Fjobteacher              .           
## guardianmother           .           
## guardianother            .           
## famsupyes                .           
## famrelexcellent          .           
## famrelgood               .           
## famrelmoderate           .           
## famrelvery bad           .           
## schoolMS                 0.3146232650
## reasonhome               .           
## reasonother              0.0007339715
## reasonreputation         0.0397818743
## traveltime>1 hr          .           
## traveltime15-30 min      .           
## traveltime30 min - 1 hr  .           
## activitiesyes            .           
## freetimelow              .           
## freetimemoderate         .           
## freetimevery high        .           
## freetimevery low         .           
## gooutlow                 .           
## gooutmoderate            .           
## gooutvery high           .           
## gooutvery low            .           
## absences                 .           
## 
## $`very high`
## 63 x 1 sparse Matrix of class "dgCMatrix"
##                                     1
## (Intercept)             -1.5400480208
## sexM                     0.8954974751
## age                      .           
## addressUrban             .           
## internetyes              .           
## romanticyes              .           
## healthgood               0.0221212479
## healthmoderate           .           
## healthvery bad           .           
## healthvery good          .           
## studytime>10 hrs         .           
## studytime2-5 hrs         .           
## studytime5-10 hrs        .           
## failures                 0.0002364946
## schoolsupyes             .           
## paidyes                  .           
## nurseryyes              -0.1574068345
## higheryes               -0.1735073661
## G1                       .           
## G2                       .           
## G3                       .           
## famsizeLE3               .           
## Pstatustogether          .           
## Medu5th - 9th grade      .           
## Meduhigher education     .           
## Medunone                 .           
## Medusecondary education  .           
## Fedu5th - 9th grade      .           
## Feduhigher education     .           
## Fedunone                 .           
## Fedusecondary education  .           
## Mjobhealth               .           
## Mjobother                .           
## Mjobservices             .           
## Mjobteacher              .           
## Fjobhealth               .           
## Fjobother                .           
## Fjobservices             .           
## Fjobteacher              .           
## guardianmother           .           
## guardianother            .           
## famsupyes                .           
## famrelexcellent          .           
## famrelgood               .           
## famrelmoderate           .           
## famrelvery bad           0.0055536703
## schoolMS                 .           
## reasonhome               .           
## reasonother              .           
## reasonreputation         .           
## traveltime>1 hr          2.4452923989
## traveltime15-30 min     -0.0112986965
## traveltime30 min - 1 hr  .           
## activitiesyes            .           
## freetimelow              .           
## freetimemoderate         .           
## freetimevery high        .           
## freetimevery low         .           
## gooutlow                 .           
## gooutmoderate            .           
## gooutvery high           1.4708657241
## gooutvery low            .           
## absences                 .           
## 
## $`very low`
## 63 x 1 sparse Matrix of class "dgCMatrix"
##                                    1
## (Intercept)              1.964922398
## sexM                    -0.142256301
## age                     -0.095531035
## addressUrban             0.378305666
## internetyes              .          
## romanticyes              .          
## healthgood               .          
## healthmoderate           0.017202315
## healthvery bad           .          
## healthvery good         -0.175358754
## studytime>10 hrs         0.715322837
## studytime2-5 hrs         0.016818753
## studytime5-10 hrs        0.305079385
## failures                 .          
## schoolsupyes             0.154069473
## paidyes                 -0.394455682
## nurseryyes               0.103816309
## higheryes               -0.004508234
## G1                       .          
## G2                       .          
## G3                       .          
## famsizeLE3              -0.113005044
## Pstatustogether          .          
## Medu5th - 9th grade      .          
## Meduhigher education     .          
## Medunone                 .          
## Medusecondary education  .          
## Fedu5th - 9th grade      .          
## Feduhigher education     .          
## Fedunone                 0.683562042
## Fedusecondary education  .          
## Mjobhealth               .          
## Mjobother                .          
## Mjobservices             .          
## Mjobteacher              .          
## Fjobhealth               0.043791214
## Fjobother                .          
## Fjobservices            -0.161007737
## Fjobteacher              0.116485556
## guardianmother           .          
## guardianother            0.001157082
## famsupyes                0.015332479
## famrelexcellent          0.186640603
## famrelgood               .          
## famrelmoderate          -0.306438167
## famrelvery bad          -0.045356821
## schoolMS                 .          
## reasonhome               .          
## reasonother             -0.064126754
## reasonreputation         .          
## traveltime>1 hr          .          
## traveltime15-30 min      0.021089547
## traveltime30 min - 1 hr -0.206855983
## activitiesyes            0.240127239
## freetimelow              .          
## freetimemoderate         .          
## freetimevery high        .          
## freetimevery low         0.269798668
## gooutlow                 0.912883037
## gooutmoderate            .          
## gooutvery high          -0.163580324
## gooutvery low            1.015974795
## absences                -0.007347194